/***
 *   @title qz
 *   @description <description class purpose>
 *   @author yichen
 *   @version 1.0.0
 *   @create 2023/10/25 0025
 **/
package io.gitee.wokaixin.yunque.message.service;

import io.gitee.wokaixin.yunque.driver.*;

public class CommonService {
    protected DriverFactory driverFactory;
    protected Driver driver;
    protected String driverType;

    public Driver getDriver() {
        return driver;
    }

    public DriverFactory getDriverFactory() {
        return driverFactory;
    }

    public String getDriverType() {
        return driverType;
    }

    public CommonService() {
//        this.driverFactory = new  DriverFactory();
//        this.driverType = "redis";
//        this.driver = driverFactory.getDriver( this.driverType);
//        System.out.println("MessageService");
    }


    public  CommonService(DriverFactory driverFactory) {
        this.driverFactory = driverFactory;
        this.driverType = "redis";
        this.driver = driverFactory.getDriver("redis");
    }

    public  CommonService(DriverFactory driverFactory, String drivertype) {
        this.driverFactory = driverFactory;
        this.driverType =drivertype;
        this.driver = driverFactory.getDriver(drivertype);
    }

    public void setDriver(Driver driver) {
        this.driver = driver;
    }

    public void setDriverFactory(DriverFactory driverFactory) {
        this.driverFactory = driverFactory;
    }

    public void setDriverType(String driverType) {
        this.driverType = driverType;
    }
}
